home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Doublets.dxr / 00107_tableau cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  3.2 KB  |  100 lines

  1. global tableau, stock, cardspicked, tabcounter, supafly, reserve, spritish, points, pootimer, shit
  2.  
  3. on beginSprite me
  4.   sprite(me.spriteNum).visible = 1
  5.   if tableau.findPos(makesymbol(throwdown(me.spriteNum))) = 0 then
  6.     tableau.addProp(makesymbol(throwdown(me.spriteNum)), new(script("tableau object"), []))
  7.     spritish.addProp(makesymbol(throwdown(me.spriteNum)), [])
  8.   end if
  9.   if tableau[makesymbol(throwdown(me.spriteNum))].cards.count = 3 then
  10.     sprite(me.spriteNum).member = stock.cards[1].rank & "_" & stock.cards[1].suit
  11.     stock.cards.deleteAt(1)
  12.     tableau[makesymbol(throwdown(me.spriteNum))].addCard(new(script("card"), me.spriteNum))
  13.   else
  14.     tableau[makesymbol(throwdown(me.spriteNum))].addCard(script("card").rawNew())
  15.     spritish[makesymbol(throwdown(me.spriteNum))].add(me.spriteNum)
  16.     reserve.add(stock.cards[1])
  17.     stock.cards.deleteAt(1)
  18.   end if
  19. end
  20.  
  21. on mouseDown me
  22.   if cardspicked.count < 2 then
  23.     if (member(sprite(me.spriteNum).memberNum).name <> "block") and (member(sprite(me.spriteNum).memberNum).name <> "backofcard") then
  24.       if me.spriteNum = tableau[makesymbol(throwdown(me.spriteNum))].getlastcard().spnum then
  25.         if cardspicked.findPos(tableau[makesymbol(throwdown(me.spriteNum))].getlastcard()) = 0 then
  26.           if cardspicked.count < 1 then
  27.             puppetSound(3, "pickcard")
  28.             cardspicked.add(tableau[makesymbol(throwdown(me.spriteNum))].getlastcard())
  29.             sprite(me.spriteNum).member = member(sprite(me.spriteNum).memberNum).name & "_black"
  30.           else
  31.             puppetSound(3, "pickcard")
  32.             cardspicked.add(tableau[makesymbol(throwdown(me.spriteNum))].getlastcard())
  33.             if chars(sprite(me.spriteNum).member.name, sprite(me.spriteNum).member.name.length - 6, sprite(me.spriteNum).member.name.length) <> "_black" then
  34.               sprite(me.spriteNum).member = member(sprite(me.spriteNum).memberNum).name & "_black"
  35.             end if
  36.             supafly = timeout("supa").new(300, #getridof)
  37.           end if
  38.         end if
  39.       else
  40.         cardspicked.deleteAll()
  41.         nameit = string(member(sprite(me.spriteNum).memberNum).name)
  42.         sprite(me.spriteNum).member = chars(nameit, 1, nameit.length - 6)
  43.       end if
  44.     end if
  45.   end if
  46. end
  47.  
  48. on mouseUp
  49.   if points = 520 then
  50.     win = "yes"
  51.     pootimer = timeout("time").new(150, #gotoit)
  52.   else
  53.     if stock.cards = 0 then
  54.       checklose()
  55.     end if
  56.   end if
  57.   checklose()
  58. end
  59.  
  60. on checkwin
  61.   global win
  62.   if points >= 520 then
  63.     win = "yes"
  64.     pootimer = timeout("time").new(150, #gotoit)
  65.   else
  66.     if stock.cards = 0 then
  67.       checklose()
  68.     end if
  69.   end if
  70.   checklose()
  71. end
  72.  
  73. on checklose me
  74.   takec = []
  75.   peking = []
  76.   abor = 1
  77.   hulio = 0
  78.   repeat with i = 1 to tableau.count
  79.     if tableau[i].cards.count <> 0 then
  80.       takec.add(tableau[i].getlastcard().rank)
  81.     end if
  82.   end repeat
  83.   taked = takec.duplicate()
  84.   repeat with y in takec
  85.     pookoo = []
  86.     repeat with e = 1 to taked.count
  87.       if y = taked[e] then
  88.         pookoo.add(taked[e])
  89.       end if
  90.       if pookoo.count >= 2 then
  91.         peking.add("PPP")
  92.       end if
  93.     end repeat
  94.   end repeat
  95.   if peking.count = 0 then
  96.     win = "no"
  97.     pootimer = timeout("time").new(150, #gotoit)
  98.   end if
  99. end
  100.